package com.yang.utils;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;

import javax.annotation.Resource;
import java.util.UUID;

public class CommonUtil {

    /* 生成四位随机数*/
    public static Integer getCode(){
        int [] array = new int[4];
        for(int i = 0; i < 4; i++){
            int  num = (int)(Math.random()*9+1);
            array[i] = num;
        }
        return  array[0]*1000 + array[1]*100 + array[2]*10 + array[3];
    }

    /* 生成随机盐*/
    public static String createSalt(){
        UUID uuid = UUID.randomUUID();
        return uuid.toString().replaceAll("-", "");
    }
}
